CONTENTS | INDEX | PREV | NEXT
fabs
ffabs
NAME
fabs - return the absolute value of a double quantity
ffabs - return the absolute value of a float quantity
SYNOPSIS
#include <math.h>
double a = fabs(b);
double b;
float c = ffabs(d);
float d;
FUNCTION
Returns the absolute value of a floating point quantity
EXAMPLE
/*
* compile with the math library -lm
*/
#include <math.h>
#include <stdio.h>
main()
{
{
double a = fabs(-0.25);
printf("fabs -0.25 = %lfn", a); /* 0.25 */
}
{ /* less accuracy */
float a = ffabs(-0.25);
printf("fabs -0.25 = %lfn", (double)a);
}
return(0);
}
INPUTS
double b; double floating point value
float d; float floating point value
RESULTS
double a; result double floating point value
float c; result float floating point value